package com.feizhi.inventory.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyDatabaseHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "mydatabase.db";
    private static final int DATABASE_VERSION = 1;

    public MyDatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // 在此方法中创建数据库表
        String createTableQuery = "CREATE TABLE IF NOT EXISTS items (" +
                "id INTEGER PRIMARY KEY AUTOINCREMENT," +
                "item_code TEXT," +
                "item_name TEXT," +
                "specification TEXT," +
                "epc_code TEXT," +
                "storage_location TEXT," +
                "custodian TEXT," +
                "department TEXT)";
        db.execSQL(createTableQuery);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // 如果需要升级数据库表结构，可以在此方法中进行相应的操作
        // 例如，您可以使用 ALTER TABLE 或 CREATE TABLE 重新创建表
    }


}
